import formBuilder from "@/comps/form/formBuilder";
import api from "./api";
import apiEmp from "@/pages/v1/erp/Emp/js/apiEmp";
import apiBuyOrder from "@/pages/v1/erp/BuyOrder/js/apiBuyOrder";
import apiBuyOrderPayType from "@/pages/v1/erp/BuyOrderPayType/js/apiBuyOrderPayType";
/*
fb.addText("belongTo","所属",3)
fb.addText("money","支付金额",3)
fb.addText("applyEmp","申请人",3)
fb.addText("payAt","支付时间",3)
fb.addText("payFeed","支付凭据",3)
fb.addText("payEmp","付款人",3)
fb.addText("isPay","是否付款",3)
fb.addText("isLock","是否锁定",3)

* */
export default {
    main:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)
        fb.addSelect("typeId","付款类型",3)
            .setApi(apiBuyOrderPayType.urlChoice)

        fb.addSearch("belongToId","采购订单",9)
            .setApi(apiBuyOrder.urlChoice)
            .setApiSearchKeys(["sn__regex","title__regex"])
            .setRules([fb.R.notNull("请输入询价单号")])

        // fb.addText("applyEmp","申请人",3)
        fb.addSearch("applyEmpId","申请人",3).setApi(apiEmp.urlChoice).setApiSearchKeys(["name__regex","phone__regex"])
        fb.addText("money","支付金额",3).setTextTypeNumber()
        fb.addDateTime("payAt","付款时间",3).setDateTypeDate()
        // fb.addText("payEmp","付款人",3)
        fb.addSearch("payEmpId","付款人",3).setApi(apiEmp.urlChoice).setApiSearchKeys(["name__regex","phone__regex"])

        fb.addFiles("payFeed","支付凭据",12)
        // fb.addText("isPay","是否付款",3)
        // fb.addText("isLock","是否锁定",3)

        return fb
    },
    tree:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)

        fb.addCascade("parentId").setLabel("上级分类").setSpan(3)
            .setApi(api.urlTree)

        fb.addText("name").setSpan(6).setLabel("分类名称")
            .setRules([fb.R.notNull("名称不能为空")])

        fb.addText("sort").setSpan(3).setLabel("排序").setTypeNumber()
        return fb
    },
    other:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100).setLabelPosition("right")

        return fb
    }
}